import { HttpClient } from '@angular/common/http';
import { ListService } from './../serves/list.service';
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-angular-day5',
  templateUrl: './angular-day5.component.html',
  styleUrl: './angular-day5.component.css'
})
export class AngularDay5Component {

  constructor(private listService : ListService){}

  // constructor(private http: HttpClient){}

  list:Array<string> | undefined;
  ngOnInit():void{
    console.log(this.listService);
    this.list = this.listService.getList();
    console.log(this.list);
  }

  addItemInfo(str:string){
    this.listService.pushList(str);
  }

  // ngOnInit():void{
  //   // request :  http://localhost:4200/serves/DemoData.json
  //   this.http.get<Array<string>>('serves/DemoData.json').subscribe(data=>{
  //     this.list = data;
  //   })
  // }

}
